package com.farmcode.console.api.model;

import com.farmcode.base.web.RowSelectedSpc;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.ManyToOne;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.OneToOne;


@Entity
@Table(name="FC_PROJECT")
public class Project extends RowSelectedSpc implements Serializable {
	//Fields
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="ID", unique=true, nullable=false, precision=18, scale=0)
	private Long id;
	@ManyToOne
	@JoinColumn(name="STATUS_ID", nullable=false)
	private Status status;
	@ManyToOne
	@JoinColumn(name="LANGUAGE_ID", nullable=false)
	private Language language;
	@ManyToOne
	@JoinColumn(name="DATABASE_ID", nullable=false)
	private Database database;
	@ManyToOne
	@JoinColumn(name="PACKAGE_ID", nullable=false)
	private PackageTemplate packageTemplate;
	@Column(name="NAME", unique=true, nullable=false, precision=10, scale=0)
	private String name;
	@Column(name="DESCRIPTION", unique=true, nullable=false, precision=50, scale=0)
	private String description;
	@OneToMany(mappedBy="project")
	private List<Match> matchCollection;
	@OneToMany(mappedBy="project")
	private List<Property> propertyCollection;
	
	//Default Constructor
	public Project() {}
	//Constructor, Parameters
	public Project(Long id, String name, String description){
		this.id = id;
		this.name = name;
		this.description = description;
	}
	//Getters and Setters
	public void setId(Long id){
		this.id = id;
	}
	public Long getId(){
		return this.id;
	}
	public void setStatus(Status status){
		this.status = status;
	}
	public Status getStatus(){
		return this.status;
	}
	public void setLanguage(Language language){
		this.language = language;
	}
	public Language getLanguage(){
		return this.language;
	}
	public void setDatabase(Database database){
		this.database = database;
	}
	public Database getDatabase(){
		return this.database;
	}
	public void setPackageTemplate(PackageTemplate packageTemplate){
		this.packageTemplate = packageTemplate;
	}
	public PackageTemplate getPackageTemplate(){
		return this.packageTemplate;
	}
	public void setName(String name){
		this.name = name;
	}
	public String getName(){
		return this.name;
	}
	public void setDescription(String description){
		this.description = description;
	}
	public String getDescription(){
		return this.description;
	}
	public List<Match> getMatchCollection(){
		return this.matchCollection;
	}
	public void setMatchCollection(List<Match> matchCollection){
		this.matchCollection = matchCollection;
	}
	public List<Property> getPropertyCollection(){
		return this.propertyCollection;
	}
	public void setPropertyCollection(List<Property> propertyCollection){
		this.propertyCollection = propertyCollection;
	}
	@Override
	public String toString(){
		return super.toString();
	}
	
}
